home *** CD-ROM | disk | FTP | other *** search
/ Champak Vol A-4 / (Vol A-4) Vol. A4.iso / Games / smashing.swf / scripts / frame_79 / DoAction.as
Text File  |  2008-03-12  |  2KB  |  43 lines

  1. function bonusActions()
  2. {
  3.    if(smashedBricks != totalBricks)
  4.    {
  5.       if(random(100) < randomBonusFactor && activeBrick.brickType != "bonus" && 0 < arrBonuses.length)
  6.       {
  7.          sndBonus.start();
  8.          randomBonus = random(arrBonuses.length);
  9.          bonusToActivate = arrBonuses[randomBonus];
  10.          if(bonusToActivate < 101)
  11.          {
  12.             _root.clipCounter = _root.clipCounter + 1;
  13.             bricks.attachMovie("mcBonus","mcBonus" + _root.clipCounter,clipCounter);
  14.             bricks["mcBonus" + _root.clipCounter].bonus.gotoAndStop(bonusToActivate);
  15.             bricks["mcBonus" + _root.clipCounter]._x = int(_root.bricks["brick" + i]._x);
  16.             bricks["mcBonus" + _root.clipCounter]._y = int(_root.bricks["brick" + i]._y);
  17.             bricks["brick" + i].swapDepths(bricks["mcBonus" + _root.clipCounter]);
  18.             totalBricks++;
  19.          }
  20.          else
  21.          {
  22.             _root.clipCounter = _root.clipCounter + 1;
  23.             _root.attachMovie("mcBonusFalling","mcBonusFalling" + _root.clipCounter,clipCounter);
  24.             _root["mcBonusFalling" + _root.clipCounter].bonus.gotoAndStop(bonusToActivate - 100);
  25.             _root["mcBonusFalling" + _root.clipCounter]._x = _root.bricks["brick" + i]._x;
  26.             _root["mcBonusFalling" + _root.clipCounter]._y = _root.bricks["brick" + i]._y;
  27.          }
  28.          arrBonuses.splice(randomBonus,1);
  29.       }
  30.       else if(ball.goldenBall && activeBrick.brickType != "bonus")
  31.       {
  32.          _root.clipCounter = _root.clipCounter + 1;
  33.          bricks.attachMovie("mcBonus","mcBonus" + _root.clipCounter,_root.clipCounter);
  34.          bricks["mcBonus" + _root.clipCounter].bonus.gotoAndStop(3);
  35.          bricks["mcBonus" + _root.clipCounter]._x = _root.bricks["brick" + i]._x;
  36.          bricks["mcBonus" + _root.clipCounter]._y = _root.bricks["brick" + i]._y;
  37.          bricks["brick" + i].swapDepths(bricks["mcBonus" + _root.clipCounter]);
  38.          totalBricks++;
  39.       }
  40.    }
  41. }
  42. gotoAndPlay(89);
  43.